
var log = taurus.client.log;
var tc = taurus.client;

class Startup {
    static web_test() {
		var client = new tc.TaurusClient("http://127.0.0.1/", "test", tc.ConnectionProtocol.Web);
		client.connect();
		
		client.send("test", tc.TObject.newInstance(), function(t){
				log.info(t.returnCode);
			
		},this);
    }
    
    public static main(): number {
        
       log.info("fdgfd{0},{1}，{2}",233,"555","dddd");
      //  Startup.web_test();
      var t = new tc.TaurusClient("127.0.0.1:8080","test",tc.ConnectionProtocol.WebSocket);
      t.connect();
       
      t.addEventListener(tc.NetClientEvent.Connect,function(evt:taurus.client.Event){
          var code = <taurus.client.SocketCode>evt.getParameter("code");
          log.info("code:{0} ddd:{1}",code,tc.SocketCode.Connect);
          if (code == tc.SocketCode.Connect) {
            var _data = tc.TObject.newInstance();
            _data.putInt("pram", 111);
            t.send("t1/test", _data, function( response:taurus.client.MessageResponse) {
                    log.info("t1 response.returnCode:{0}",response.returnCode);
                    
                    if(response.returnCode == 0) {
                        
                    }
                
            },this);
            // client.send("t2/test", _data, new ICallback<MessageResponse>() {
            //     @Override
            //     public void action(MessageResponse response) {
            //         System.out.println(String.format("t2 response.returnCode:%s",response.returnCode));
            //         if(response.returnCode == 0) {
                        
            //         }
            //     }
            // });
        }else {
            log.info("连接失败");
            t.killConnection();
        }
            // log.info("sss:{1}",evt.params["code"]);
      },this);
      
        return 0;
    }



}

Startup.main();